﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Douban.Api.Infrastructure
{
    public class AttributeElementAttribute : ElementAttribute
    {
        private readonly string _attribute;
        private readonly string _value;

        public AttributeElementAttribute(string value) : this("name", value) {}

        public AttributeElementAttribute(string attribute, string value) : base("attribute", NsManager.Douban)
        {
            _attribute = attribute;
            _value = value;
        }

        public override string GetXPath(System.Xml.XmlNamespaceManager nsManager)
        {
            return base.GetXPath(nsManager) + string.Format("[@{0}='{1}']", _attribute, _value);
        }
    }
}
